<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div>
      {{ info }}
      <!-- 让事件绑定某个方法 -->
      <input type="button" value="按钮1" @click="f()" />
      <input type="button" value="按钮2" v-on:click="f()" />
    </div>

    <!-- 本地引入vue.js框架文件 -->
    <script src="js/vue.js"></script>
    <script>
      let app = new Vue({
        el: "body>div",
        data: {
          info: "事件绑定测试",
        },
        methods: {
          f() {
            alert("按钮点击了!");
          },
        },
      });
    </script>
  </body>
</html>
